<%@ page import="com.sdust.entity.Product" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>商品</title>
    <style>
        table {
            width: 80%;
            border-collapse: collapse;
            margin: 20px auto;
        }

        th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }

        th {
            background-color: #f2f2f2;
        }

        div {
            margin-bottom: 50px;
        }
    </style>
</head>
<body>

<%
    HttpSession sessionLocal = request.getSession();
    List<Product> products = (List<Product>) sessionLocal.getAttribute("cart");
%>

<div>
    <table>
        <thead>
        <tr>
            <th>商品名称</th>
            <th>商品价格</th>
            <th>商品数量</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <%
                if (products.size() > 0) {
                    for (Product product : products){
            %>
            <td> <%= product.getName() %> </td>
            <td> <%= product.getPrice() %> </td>
            <td> <%= product.getQuantity() %> </td>
            <%
                    }
                }
            %>
        </tr>

        </tbody>
    </table>
</div>


</body>
</html>
